﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AAA.Meta.Trade.Data
{
    [Serializable]
    public class OrderInfo
    {
        //TS產生訊號時間
        private string _strTSSignalTime;
        //由TS抓取訊號時間
        private string _strTSCatchTime;
        //下單主機讀取訊號時間
        private string _strOrderTime;
        //券商委託回報時間
        private string _strResponseTime;
        //實際成交回報時間
        private string _strDealTime;
        //期貨帳號
        private string _strAccountNo;
        //商品代碼
        private string _strSymbol;
        //商品代碼(通用)
        private string _strSymbolCode;
        //商品名稱
        private string _strSymbolName;
        //策略名稱
        private string _strStrategy;
        //訊號類別 SE,SX,LE,LX
        private string _strOrderType;
        //訊號內容
        private string _strOrder;
        //策略時間長度
        private string _strInterval;
        //Entry ID
        private string _strEntryID;
        //委託價位
        private string _strFilledPrice;
        //委託數量
        private int _iFilledVolume;
        //滑價點數
        private string _strSlippage;
        //是否為單沖單
        private bool _isIntraDay;
        //實際成交價位
        private string _strDealPrice;
        //實際成交數量
        private int _iDealVolume;
        //交易訊息
        private string _strMessage;
        //委託單號
        private string _strOrderNo;
        //委託單索引
        private string _strOrderID;
        //交易類別
        private string _strTXType;
        //交易所
        private string _strExchange;
        //到期年份
        private string _strYear;
        //到期月份
        private string _strMonth;
        //Put or Call
        private string _strPutOrCall;
        //履約價
        private string _strExercisePrice;
        //區分平倉單
        private bool _isDistinctExitOrder;
        //是否為預約單
        private bool _isAppointment;

        public bool IsAppointment
        {
            get { return _isAppointment; }
            set { _isAppointment = value; }
        }

        public bool IsDistinctExitOrder
        {
            get { return _isDistinctExitOrder; }
            set { _isDistinctExitOrder = value; }
        }


        public string TSSignalTime
        {
            get { return _strTSSignalTime; }
            set { _strTSSignalTime = value; }
        }

        public string TSCatchTime
        {
            get { return _strTSCatchTime; }
            set { _strTSCatchTime = value; }
        }

        public string OrderTime
        {
            get { return _strOrderTime; }
            set { _strOrderTime = value; }
        }

        public string ResponseTime
        {
            get { return _strResponseTime; }
            set { _strResponseTime = value; }
        }

        public string DealTime
        {
            get { return _strDealTime; }
            set { _strDealTime = value; }
        }

        public string AccountNo
        {
            get { return _strAccountNo; }
            set { _strAccountNo = value; }
        }

        public string Symbol
        {
            get { return _strSymbol; }
            set { _strSymbol = value; }
        }

        public string SymbolCode
        {
            get { return _strSymbolCode; }
            set { _strSymbolCode = value; }
        }

        public string SymbolName
        {
            get { return _strSymbolName; }
            set { _strSymbolName = value; }
        }

        public string Strategy
        {
            get { return _strStrategy; }
            set { _strStrategy = value; }
        }

        public string OrderType
        {
            get { return _strOrderType; }
            set { _strOrderType = value; }
        }

        public string Order
        {
            get { return _strOrder; }
            set { _strOrder = value; }
        }

        public string Interval
        {
            get { return _strInterval; }
            set { _strInterval = value; }
        }

        public string EntryID
        {
            get { return _strEntryID; }
            set { _strEntryID = value; }
        }

        public string FilledPrice
        {
            get { return _strFilledPrice; }
            set { _strFilledPrice = value; }
        }

        public int FilledVolume
        {
            get { return _iFilledVolume; }
            set { _iFilledVolume = value; }
        }

        public string Slippage
        {
            get { return _strSlippage; }
            set { _strSlippage = value; }
        }

        public bool IntraDay
        {
            get { return _isIntraDay; }
            set { _isIntraDay = value; }
        }

        public string DealPrice
        {
            get { return _strDealPrice; }
            set { _strDealPrice = value; }
        }

        public int DealVolume
        {
            get { return _iDealVolume; }
            set { _iDealVolume = value; }
        }

        public string Message
        {
            get { return _strMessage; }
            set { _strMessage = value; }
        }

        public void appendMessage(string strMessage)
        {
            _strMessage += strMessage;
        }


        public string OrderNo
        {
            get { return _strOrderNo; }
            set { _strOrderNo = value; }
        }

        public string OrderID
        {
            get { return _strOrderID; }
            set { _strOrderID = value; }
        }

        public string TXType
        {
            get { return _strTXType; }
            set { _strTXType = value; }
        }

        public string Exchange
        {
            get { return _strExchange; }
            set { _strExchange = value; }
        }

        public string Year
        {
            get { return _strYear; }
            set { _strYear = value; }
        }

        public string Month
        {
            get { return _strMonth; }
            set { _strMonth = value; }
        }

        public string PutOrCall
        {
            get { return _strPutOrCall; }
            set { _strPutOrCall = value; }
        }

        public string ExercisePrice
        {
            get { return _strExercisePrice; }
            set { _strExercisePrice = value; }
        }


        public string Side
        {
            get
            {
                if ((_strOrderType == "LE") || (_strOrderType == "SX"))
                    return "Buy";
                if ((_strOrderType == "SE") || (_strOrderType == "LX"))
                    return "Sell";
                return "Undefined";
            }
        }

        public string PositionEffect
        {
            get
            {
                if ((_strOrderType == "LE") || (_strOrderType == "SE"))
                    return "Open";
                if ((_strOrderType == "LX") || (_strOrderType == "SX"))
                    return "Close";
                return "Undefined";
            }
        }

    }
}
